package com.servlet;

import com.Dao.BookDao;
import com.bean.BookBean;
import com.util.DBUtil;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;
import java.sql.Connection;
import java.util.ArrayList;
@WebServlet(name = "bookDisplayServlet", value = "/bookDisplayServlet")
public class bookDisplayServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        request.setCharacterEncoding("UTF-8");
        response.setContentType("text/html;charset=UTF-8");
        HttpSession session=request.getSession();
        ArrayList<BookBean> list = new ArrayList<BookBean>();
        Connection conn= DBUtil.getConnectDb();
        BookDao bookDao = new BookDao();
        list=bookDao.get_ListInfo();
        session.setAttribute("list1",list);
        response.sendRedirect("bookmassage.jsp");

    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }
}
